/* Control Leds-Line
  Control ligting LEDS connected analog pin A0.
*/

// Includes
#include <FastLED.h>     // Leds line

// Constants
#define LED_PIN   A0
#define NUM_LEDS  52
#define CLK 7
#define DIO 8

// Init libs
CRGB leds[NUM_LEDS];
GyverTM1637 disp(CLK, DIO);

// Variables
byte DELAY_LED = 30;
byte BRIGHTNESS = 70;



void setup() {
//  Serial.begin(9600);
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness( BRIGHTNESS );
  disp.clear();
  disp.brightness(7);
}

void loop() {
  blickMode();
}

uint32_t Now, clocktimer;
boolean flag;

void blickMode() {
  blickLeds(1);  // White
  blickLeds(2);  // Red
  blickLeds(3);  // Yellow
  blickLeds(5);  // Green
  blickLeds(6);  // Blue
  blickLeds(10); // Purple
  delay(10000);

  blickLeds(13); // DarkRed
  blickLeds(28); // ForestGreen
  blickLeds(31); // MediumAquamarine
  blickLeds(32); // LimeGreen
  blickLeds(20); // DarkCyan
  blickLeds(10); // Purple
  blickLeds(28); // ForestGreen
  delay(10000);
  
  blickLeds(8);  // SkyBlue
  blickLeds(13); // DarkRed
  blickLeds(4);  // Orange
  blickLeds(29); // OliveDrab
  blickLeds(17); // SeaGreen
  blickLeds(16); // Navy
  blickLeds(22); // Aquamarine
  blickLeds(32); // LimeGreen
  delay(10000);
  
  blickLeds(24); // Aqua
  blickLeds(11); // Maroon
  blickLeds(3);  // Yellow
  blickLeds(5);  // Green
  blickLeds(19); // CadetBlue
  blickLeds(18); // Teal
  blickLeds(13); // DarkRed
  delay(10000);
  
  blickLeds(25); // LightSkyBlue
  blickLeds(13); // DarkRed
  blickLeds(33); // YellowGreen
  blickLeds(11); // Maroon
  blickLeds(28); // ForestGreen
  blickLeds(7);  // DarkBlue
  blickLeds(4);  // Orange
  delay(10000);
}

// Functions LED-COLORS
void blickLeds(unsigned int color) {
    // Cycle LED-COLOR and in to switch change color
    for (int i = 0; i < NUM_LEDS; i++) {
      switch(color) {
        case 1:
          leds[i] = CRGB::White;
          break;
        case 2:
          leds[i] = CRGB::Red;
          break;
        case 3:
          leds[i] = CRGB::Yellow;
          break;
        case 4:
          leds[i] = CRGB::Orange;
          break;
        case 5:
          leds[i] = CRGB::Green;
          break;
        case 6:
          leds[i] = CRGB::Blue;
          break;
        case 7:
          leds[i] = CRGB::DarkBlue;
          break;
        case 8:
          leds[i] = CRGB::SkyBlue;
          break;
        case 9:
          leds[i] = CRGB::Blue;
          break;
        case 10:
          leds[i] = CRGB::Purple;
          break;
        case 11:
          leds[i] = CRGB::Maroon;
          break;
        case 12:
          leds[i] = CRGB::MidnightBlue;
          break;
        case 13:
          leds[i] = CRGB::DarkRed;
          break;
        case 14:
          leds[i] = CRGB::MediumBlue;
          break;
        case 15:
          leds[i] = CRGB::LawnGreen;
          break;
        case 16:
          leds[i] = CRGB::Navy;
          break;
        case 17:
          leds[i] = CRGB::SeaGreen;
          break;
        case 18:
          leds[i] = CRGB::Teal;
          break;
        case 19:
          leds[i] = CRGB::CadetBlue;
          break;
        case 20:
          leds[i] = CRGB::DarkCyan;
          break;
        case 21:
          leds[i] = CRGB::CornflowerBlue;
          break;
        case 22:
          leds[i] = CRGB::Aquamarine;
          break;
        case 23:
          leds[i] = CRGB::SeaGreen;
          break;
        case 24:
          leds[i] = CRGB::Aqua;
          break;
        case 25:
          leds[i] = CRGB::LightSkyBlue;
          break;
        case 26:
          leds[i] = CRGB::DarkGreen;
          break;
        case 27:
          leds[i] = CRGB::DarkOliveGreen;
          break;
        case 28:
          leds[i] = CRGB::ForestGreen;
          break;
        case 29:
          leds[i] = CRGB::OliveDrab;
          break;
        case 30:
          leds[i] = CRGB::SeaGreen;
          break;
        case 31:
          leds[i] = CRGB::MediumAquamarine;
          break;
        case 32:
          leds[i] = CRGB::LimeGreen;
          break;
        case 33:
          leds[i] = CRGB::YellowGreen;
          break;
        case 34:
          leds[i] = CRGB::LightGreen;
          break;
      }
      delay(DELAY_LED);
      FastLED.show();
    }
}
